<?php
cload("database.dbquery");
cload("object");

/**
 * Description of distrList
 *
 * @author Di_Moon
 */
class distributeList {
    protected $_dbh;
    protected $_filmid;
    protected $_list;
    protected $_listArr;
    
    function __construct($dbh, $filmid=0) {
        $this->_dbh = $dbh;
        $this->_filmid = (int)$filmid;
        
        $where = "";
        
        if($this->_filmid!=0) $where = " and filmsKinoPoisk.id=".$this->_filmid;
        
        $sql = "SELECT filmsKinoPoisk . * , distribution.id AS DID, distribution . * 
FROM distribution, filmsKinoPoisk
WHERE filmsKinoPoisk.id = distribution.filmid".$where;
        
        $this->_list = array();
        $this->_listArr = array();
        
        // echo $sql;

        $sth = $this->_dbh->querysql($sql);
        while($fa=$this->_dbh->raw_fetch_array($sth)) {
            $_row = new object($fa);
            array_push($this->_list, $_row);
            array_push($this->_listArr, $_row->getElements());
        }
        
        //_print_r($this->_list);
    }
    
    function getList() { return $this->_list; }
    function getListArr() { return $this->_listArr; }
}

?>
